<template>
	<!--
    	作者：fuyuan
    	时间：2019-07-18
    	描述：用户
    -->
	<div class="Announcements">
		<div class="location">
			<div class="location-text fl">
				<img class="location-img fl" src="../../images/home/i.png" />
				<p class="fr">用户管理</p>
			</div>
			<img class="biaotibg fl" src="../../images/home/biaotibg.png" />
		</div>
		<div class="search-box">
			<div class="fl">
				<input class="search" id="searchUserVal" type="text" placeholder="搜索用户名"/>
				<input class="btn" @click="searchUser" type="button" value="查询" />
			</div>
			<div class="fr">
				<!--<router-link to='/addUser/null'>-->
				<div @click="editorUser(null)" class="user-box user-name">添加用户</div>
				<!--</router-link>-->
			</div>
		</div>
		<div class="PressRelease-list">
			<table>
				<thead>
					<tr>
						<th class="table-text-th1">序号</th>
						<th class="table-text-th1">姓名</th>
						<th class="table-text-th1">角色</th>
						<th class="table-text-th1">创建日期</th>
						<th class="table-text-th2">联系电话</th>
						<th class="table-text-th1">用户状态</th>
						<th class="table-text-th4">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="(model,index) in userData">
						<td>{{index+1}}</td>
						<td>{{model.userName}}</td>
						<td>{{model.roleName}}</td>
						<td>{{formatData(model.createAt, "yyyy-MM-dd")}}</td>
						<td>{{model.userPhoneNumber}}</td>

            <td>
              <input v-if="model.userAccountStatus == 1" type="button" value="启用" class="delete write" @click="editStatus(model.id,0)" />
              <input v-else type="button" value="冻结" class="delete write" @click="editStatus(model.id,1)" />
            </td>


						<td>
							<input type="button" value="编辑" class="delete write" @click="editorUser(model.id)" />
							<input type="button" value="删除" class="delete write" @click="deleteUser(model.id, model.roleName)" />
							<input type="button" value="查看" class="delete write" @click="viewUser(model.id)" />
						</td>
					</tr>

				</tbody>
			</table>
			<!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->
			<pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
		</div>
	</div>
</template>

<script src="./userList.js"></script>

<style scoped>
	@import "userList.css";
</style>
